local RankContentGuildCell = app.mvc.createListViewCell(...)
local NewguildIconRender = require("app.newGuild.views.renders.NewguildIconRender")
local RankContentBaseRender = import(".RankContentBaseRender")
--data =
function RankContentGuildCell.create(node)
    local sprite = RankContentGuildCell.extend(node or cc.CSLoader:createNode(Res.RankGuildCell))
    if node == nil then
        ccui.Helper:doLayout(sprite)
    end
    sprite:init()
    return sprite
end


function RankContentGuildCell:init(data)
    self.super.init(self, data)
    self:setContentSize( self._ui.Panel:getContentSize() )

    self._rankBaseRender = RankContentBaseRender.create(self._ui["Panel/baseRankCell"])
    self._guildIconRender = NewguildIconRender.create(self._ui["Panel/icon"])

    self._ui["Panel/Button_1"]:addClickEventListener(function(sender)
        if self._data then
            self:dispatchCellEvent("lookGuild", self._data.guildInfo)
        end
    end)
end

function RankContentGuildCell:refresh()
    if not self._data then
        return
    end
    local data = self._data
    self._rankBaseRender:setRank(data.rank)
    local isMy = false
    local guildInfo = data.guildInfo
    if guildInfo then
        self._guildIconRender:setData(guildInfo:getGuildIconData())
        local myGuidId = UD:getGuildId()
        isMy = (myGuidId == guildInfo:getGuildId() and myGuidId ~= 0)
    end
    self._rankBaseRender:setIsMy(isMy)

    if data.value11 then
        self._ui["Panel/value1"]:setPositionY(59)
        self._ui["Panel/value11"]:setString(data.value11)
    else
        self._ui["Panel/value1"]:setPositionY(47)
    end

    self._ui["Panel/value1"]:setString(data.value1)
    self._ui["Panel/value2"]:setString(data.value2)
    self._ui["Panel/value3"]:setString(data.value3)
  

end


return RankContentGuildCell